#include<stdio.h>
#include<iostream>
#include<string.h>
#include <algorithm>
using namespace std;
int main()
{
	int n, i;
	float max, min, sum,num;
	while (cin >> n)
	{
		max = -1, min = 0x3f3f3f, sum = 0;
		for (i = 0; i < n; i++)
		{
			cin >> num;
			sum += num;
			if (num > max)max = num;
			if (num < min)min = num;
		}
		printf("%.2f\n", (sum - max - min) / (n - 2));
	}
	
	return 0;
}